package cn.eastseven.netserver;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SimpleProtocolCodecFactory extends TextLineCodecFactory {

	private static final Logger log = LoggerFactory.getLogger(SimpleProtocolCodecFactory.class);
	
	@Autowired
	private ProtocolDecoder protocolDecoder;
	
	@Autowired
	private ProtocolEncoder protocolEncoder;
	
	@Override
	public ProtocolDecoder getDecoder(IoSession session) {
		log.debug("getDecoder: sessionId={}", session.getId());
		return super.getDecoder(session);
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) {
		log.debug("getEncoder: sessionId={}", session.getId());
		return super.getEncoder(session);
	}
}
